package com.y.comtoo.file;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;

public class Caller {

	public static void main(String[] args) throws IOException {
    	File dir = new File("D://workspace/hb-jf-mybatis/delivery-acom/src/main/java/com/microsvc");
    	replaceDomain(dir);
	}
	
	public static void replaceDomain(File dir) throws IOException {
    	File[] flist = dir.listFiles();
    	for(File f : flist) {
    		if(f.isDirectory()) {
    			replaceDomain(f);
    		}else {
        		List<String> lines = Files.readAllLines(Paths.get(f.getPath()));
        		for(int i=0; i<lines.size() && i<50; i++) {
        			if(lines.get(i).contains("javax.persistence.")) {
        	    		FileTool.Copy(f.getPath(), f.getPath());
        	    		break;
        			}
        		}
    		}
    	}
	}

}
